﻿@model Project_2._2.ViewModels.CarList_ViewModel
@{
    ViewBag.Title = "Cập Nhật Thông Tin Xe cho Thuê ";
    Layout = "~/Views/Shared/_AdminLayoutPage.cshtml";
    Project_2._2.Models.QuanLyThueXeEntities db = new Project_2._2.Models.QuanLyThueXeEntities();
    <script src="~/Content/ckfinder/ckfinder.js"></script>
    <script src="~/Script/jquery-1.3.2.min.js"></script>
    <script src="~/Content/ckeditor_4.3.1_full/ckeditor/ckeditor.js"></script>
    <link href="~/Content/DateTimePicker_Css/jquery.datetimepicker.css" rel="stylesheet" />
    <script src="~/Script/DateTimePicker_Js/jquery.js"></script>
    <script src="~/Script/DateTimePicker_Js/jquery.datetimepicker.js"></script>

    <script type="text/javascript" lang="ja">

        document.getElementById("news").setAttribute("class", "activee")
    </script>

}
<div class="grid_12">
    <div class="block-border">
        <div class="block-header">
            Cập Nhật Thông Tin Xe Cho Thuê
            @Html.ActionLink("Trở về Danh Sách", "Default", "AdminCars", null, new { @class = "button" })
        </div>
        <div class="block-content">

            @using (Html.BeginForm("Update", "AdminCars", FormMethod.Post, new { id = "form", enctype = "multipart/form-data" }))
            {
                @Html.ValidationSummary(true)
                @Html.AntiForgeryToken()

                <table style=" line-height: 35px; color: #808080; font-weight: bold">
                    <tr>
                        <td style="padding-left:10px;padding-top : 20px"><label>Tên Xe</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 20px">
                            @Html.TextBoxFor(m => m.name, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.name)
                        </td>

                        <td style=" padding-top:20px"><label>Thương Hiệu Xe</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 20px">
                            @{

                                List<SelectListItem> Listthuonghieu = new List<SelectListItem>();
                                var Listth = from p in db.ThuongHieux select p;
                                foreach (var item in Listth)
                                {
                                    Listthuonghieu.Add(new SelectListItem { Text = item.TenThuongHieu, Value = Convert.ToString(item.ThuongHieuId) });
                                }
                            }
                            @Html.DropDownListFor(m => m.ThuongHieuID, Listthuonghieu, new { @class = "select", style = @"width: 370px" })
                        </td>
                    </tr>

                    <tr>
                        <td style="padding-left: 10px; padding-top: 10px"><label>Dòng Xe</label><span style="color:red"> *</span></td>
                        <td>
                            @Html.TextBoxFor(m => m.DongXe, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.DongXe)
                        </td>
                        <td style="padding-top: 10px"><label>Phụ Trợ Quá KM</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.PhuTroKM, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.PhuTroKM)
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left: 10px; padding-top: 10px; "><label>Loại Xe</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @{

                                List<SelectListItem> ListLoaiXe = new List<SelectListItem>();
                                var Listlx = from p in db.LoaiXes select p;
                                foreach (var item in Listlx)
                                {
                                    ListLoaiXe.Add(new SelectListItem { Text = item.TenLoaiXe, Value = Convert.ToString(item.LoaiXeId) });
                                }
                            }
                            @Html.DropDownListFor(m => m.LoaiID, ListLoaiXe, new { @class = "select", style = @"width: 370px" })
                        </td>

                        <td style="padding-top: 10px"><label>Sử Dụng Cuối Tuần</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.SuDungCuoiTuan, new { @class = "Textbox", style = @"width: 360px" })
                            <br /> @Html.ValidationMessageFor(m => m.SuDungCuoiTuan)
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left: 10px; padding-top: 10px"><label>Đời Xe</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.DoiXe, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.DoiXe)
                        </td>

                        <td style="padding-top: 10px"><label>Phụ Trợ Ngoài Giờ</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.PhuTroNgoaiGio, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.PhuTroNgoaiGio)
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left: 10px; padding-top: 10px"> <label>Dịch Vụ</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @{

                                List<SelectListItem> ListServiec = new List<SelectListItem>();
                                var Listdv = from p in db.DichVuThueXes select p;
                                foreach (var item in Listdv)
                                {
                                    ListServiec.Add(new SelectListItem { Text = item.TenDichVu, Value = Convert.ToString(item.DichVuId) });
                                }
                            }
                            @Html.DropDownListFor(m => m.dichvuID, ListServiec, new { @class = "select", style = @"width: 370px" })
                        </td>
                        <td style=" padding-top: 10px"> <label>Màu Xe</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.Color, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.Color)
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left: 10px; width: 100px; padding-top: 10px"> <label>Trạng Thái</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @{
                                List<SelectListItem> listtt = new List<SelectListItem>();
                                listtt.Add(new SelectListItem { Text = "Sẵn Sàng", Value = "Sẵn Sàng", Selected = true });
                                listtt.Add(new SelectListItem { Text = "Đang Bận", Value = "Đang Bận" });
                            }
                            @Html.DropDownListFor(m => m.TThai, listtt, new { @class = "select", style = @"width: 370px" })
                        </td>
                        <td style=" padding-top: 10px"> <label>Giá Cho Thuê</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.Gia, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.Gia)
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left: 10px; width: 100px; padding-top: 10px"> <label>Hình Ảnh</label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            <input type="file" id="file" name="uploadFile" />
                        </td>
                        <td style=" padding-top: 10px"> <label>Clip Quảng Cáo </label><span style="color:red"> *</span></td>
                        <td style="padding-top: 10px">
                            @Html.TextBoxFor(m => m.Video, new { @class = "Textbox", style = @"width: 360px" })
                            <br />@Html.ValidationMessageFor(m => m.Video)
                        </td>
                    </tr>
                    <tr>
                        <td>Chi Tiết</td>
                        <td colspan="3">
                            @Html.TextAreaFor(m => m.ChiTiet)
                            @Html.ValidationMessageFor(m => m.ChiTiet)
                        </td>
                    </tr>
                    <tr>
                        <td class="align-right" style="padding-top:12px">@Html.LabelFor(m => m.captcha) <span style="color:red">  *  </span></td>
                        <td style="padding-top:12px">
                            @Html.TextBoxFor(m => m.captcha, new { @class = "Textbox validate[required]", @style = "width:80px" })
                            <img id="Img3" alt="Captcha image" src="~/Captcha/Captcha" style=" margin-bottom:-10px; height:29px;border-radius:4px; " />
                            @Html.ValidationMessageFor(m => m.captcha)
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center" colspan="4">
                            <input type="submit" value="Cập Nhật Thông Tin" class="MyButton" />
                        </td>
                    </tr>
                </table><br />
            }

        </div>

    </div>
</div>
<script language="javascript" type="text/javascript">

    $(function () {
        $("#chonanhbia").click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#anhbia").val(fileUrl);
            };
            finder.popup();
        });
    });
</script>


<script type="text/javascript">

    $(document).ready(function () {
        $("#form").submit(function (e) {

            $("#ChiTiet").val(CKEDITOR.instances["ChiTiet"].getData());
            $(this).submit();
        });

        CKEDITOR.replace('ChiTiet',
        {
            filebrowserBrowseUrl: 'Create.cshtml'
        });
    });
</script>





